home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
Keyboard.pxl
< prev
next >
Wrap
Text File
|
2001-06-21
|
5KB
|
219 lines
{ PiXCL program to get keyboard input and draw it on the client area }
Initialize:
UseCoordinates(PIXEL)
Title$ = "Keyboard Input Test"
WinGetActive(Current$)
WinTitle(Current$,Title$)
WinLocate(Title$,100,60,400,280,Res)
InfoMenu(REMOVE)
WaitInput(100)
SetMenu("Exit!",Terminate,
ENDPOPUP,
"Start",Get_Input,
ENDPOPUP,
"Concept",Concept,
ENDPOPUP)
Wait_for_Input:
WaitInput()
Concept:
MessageBox(OK,1,INFORMATION,
"This sample application show how to create text entry
dialogs in the client area of your PiXCL program. The
dialog area is written with an OPAQUE background so the
text is highlighted. A carriage return is the programmed
default delimiter character: it could just as easily be
the TAB character.
Multiple text entry boxes can be programmed: Entered text
is saved in variable Input$, which can then be copied to
a 'permanent' variable, and Input$ reset to NULL, ready to
process the next text input box. You can use the SetMouse()
command to make each text input box active at your command.
Finally, the key list can be extended to any almost any
character on the keyboard, and can be assigned a character
from any installed font.",
"'Keyboard.pxl' Sample Application",Res)
Goto Wait_for_Input
Terminate:
End
Get_Input:
GoSub Define_Keys
Input$ = ""
UseBackGround(TRANSPARENT,255,255,255)
DrawBackGround
UsePen(SOLID,1,0,0,0)
UseBrush(SOLID,255,255,255)
DrawRectangle(15,30,260,55)
UseFont("Arial",7,11,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
DrawText(20,18,"Enter the first line of characters")
Goto Wait_for_Input
Get_Keys_A: {process the keystrokes}
Key$ = "A"
Goto Process
Get_Keys_B:
Key$ = "B"
Goto Process
Get_Keys_C:
Key$ = "C"
Goto Process
Get_Keys_D:
Key$ = "D"
Goto Process
Get_Keys_E:
Key$ = "E"
Goto Process
Get_Keys_F:
Key$ = "F"
Goto Process
Get_Keys_G:
Key$ = "G"
Goto Process
Get_Keys_H:
Key$ = "H"
Goto Process
Get_Keys_I:
Key$ = "I"
Goto Process
Get_Keys_J:
Key$ = "J"
Goto Process
Get_Keys_K:
Key$ = "K"
Goto Process
Get_Keys_L:
Key$ = "L"
Goto Process
Get_Keys_M:
Key$ = "M"
Goto Process
Get_Keys_N:
Key$ = "N"
Goto Process
Get_Keys_O:
Key$ = "O"
Goto Process
Get_Keys_P:
Key$ = "P"
Goto Process
Get_Keys_Q:
Key$ = "Q"
Goto Process
Get_Keys_R:
Key$ = "R"
Goto Process
Get_Keys_S:
Key$ = "S"
Goto Process
Get_Keys_T:
Key$ = "T"
Goto Process
Get_Keys_U:
Key$ = "U"
Goto Process
Get_Keys_V:
Key$ = "V"
Goto Process
Get_Keys_W:
Key$ = "W"
Goto Process
Get_Keys_X:
Key$ = "X"
Goto Process
Get_Keys_Y:
Key$ = "Y"
Goto Process
Get_Keys_Z:
Key$ = "Z"
Goto Process
Get_Keys_Slash:
Key$ = "\"
Goto Process
Get_Keys_Stop:
Key$ = "."
Goto Process
Get_Keys_Colon:
Key$ = ":"
Goto Process
Get_Keys_SP:
Key$ = " "
Process:
Input$ = Input$ + Key$
Len(Input$,Long)
{Str(Long,Long$)
MessageBox(OK,1,INFORMATION,Long$,"DEBUG: Input$ length",Res) }
If Long <= 24 Then Goto Process_1
MessageBox(OK,1,EXCLAMATION,
"Input Length exceeds 24 characters. This is an
arbitrary number under your PiXCL script control.",
"WARNING: Input string too long",Res)
Long = 0
Goto Wait_For_Input
{endif}
Process_1:
UseFont("System",9,15,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
UseBackGround(OPAQUE,164,200,240)
DrawText(StartX,StartY,Input$)
Goto Wait_for_Input
Get_Keys_CR:
MessageBox(OK,1,EXCLAMATION,Input$,"String entered in edit region",Res)
Goto Wait_for_Input
Get_Keys_Del:
Len(Input$,Long) If Long >=1 Then Long = Long - 1
Left(Input$,Long,Input$)
UseBrush(SOLID,255,255,255)
DrawRectangle(15,30,260,55)
DrawText(StartX,StartY,Input$)
Goto Wait_for_Input
{===========================================================================}
Define_Keys: {subroutine}
StartX = 20 StartY = 33
SetKeyboard()
SetKeyboard("a",Get_Keys_A,"A",Get_Keys_A,
"b",Get_Keys_B,"B",Get_Keys_B,
"c",Get_Keys_C,"C",Get_Keys_C,
"d",Get_Keys_D,"D",Get_Keys_D,
"e",Get_Keys_E,"E",Get_Keys_E,
"f",Get_Keys_F,"E",Get_Keys_F,
"g",Get_Keys_G,"E",Get_Keys_G,
"h",Get_Keys_H,"E",Get_Keys_H,
"i",Get_Keys_I,"E",Get_Keys_I,
"j",Get_Keys_J,"E",Get_Keys_J,
"k",Get_Keys_K,"E",Get_Keys_K,
"l",Get_Keys_L,"E",Get_Keys_L,
"m",Get_Keys_M,"E",Get_Keys_M,
"n",Get_Keys_N,"E",Get_Keys_N,
"o",Get_Keys_O,"E",Get_Keys_O,
"p",Get_Keys_P,"E",Get_Keys_P,
"q",Get_Keys_Q,"E",Get_Keys_Q,
"r",Get_Keys_R,"E",Get_Keys_R,
"s",Get_Keys_S,"E",Get_Keys_S,
"t",Get_Keys_T,"E",Get_Keys_T,
"u",Get_Keys_U,"E",Get_Keys_U,
"v",Get_Keys_V,"E",Get_Keys_V,
"w",Get_Keys_W,"E",Get_Keys_W,
"x",Get_Keys_X,"E",Get_Keys_X,
"y",Get_Keys_Y,"E",Get_Keys_Y,
"z",Get_Keys_Z,"E",Get_Keys_Z,
" ",Get_Keys_SP,13,Get_Keys_CR,
"\",Get_Keys_Slash,".",Get_Keys_Stop,
":",Get_Keys_Colon, 46,Get_Keys_Del,
8,Get_Keys_Del)
{additional keys can be added here, as desired.}
Return
{===========================================================================}
UnDefine_Keys: {subroutine}
SetKeyboard()
Return